/**
 * @description 定义通用的状态管理器对象
 */
import { deCodeApi, enCodeApi } from "@/util"
const common = {
    namespaced: true,
    state: {
        token: '',
        userInfo: {}
    },
    getters: {
        token(_state) {
            return !!_state.token ? deCodeApi(_state.token) : ''
        },
        userInfo:_state=>_state.userInfo
    },
    mutations: {
        setToken(_state, _token) {
            // debugger
            _state.token = enCodeApi(_token)
        },
        setUserInfo(_state, _userInfo) {
            _state.userInfo = _userInfo
        }
    }
}
export default common